﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Linq;
using System.Text;

namespace GBlason.Common.Tools
{
    public static class OrderedDictionaryExtensions
    {
        /// <summary>
        /// Return the index of the given key
        /// </summary>
        /// <param name="dico">The dico.</param>
        /// <param name="key">The key.</param>
        /// <returns></returns>
        public static int IndexOfKey(this OrderedDictionary dico, Object key)
        {
            var keys = dico.Keys;
            var index = 0;
            foreach (var obj in keys)
            {
                if (obj.Equals(key))
                    return index;
                index++;
            }
            return -1;
        }
    }
}
